feat: support for aptos#482
Conversation
🦋 Changeset detectedLatest commit: 190a942 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Pull request overview
This PR adds first-class Aptos support to the Omni Bridge SDK by introducing a new @omni-bridge/aptos package (payload builder + event/log helpers) and wiring the new chain through the core SDK types/config/API schemas and NEAR-side storage-account borsh serialization. It also updates the umbrella @omni-bridge/sdk package and documentation to expose and describe the new chain.
Changes:
- Add
@omni-bridge/aptospackage with builder (init_transfer,log_metadata,deploy_token,fin_transfer), encoding utilities, and Aptos fullnode event helpers + tests. - Thread
ChainKind.Aptos/aptos:OmniAddress support through core (types,address+tokenutils,bridgecontract resolution, API zod schemas) and NEAR storage borsh address parsing (incl. short-form zero-padding parity). - Update SDK exports, monorepo refs/changesets, and docs (guides + reference) to include Aptos; add a GitHub workflow/scripts for Claude-based PR review context.
Reviewed changes
Copilot reviewed 41 out of 43 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Add packages/aptos as a TS project reference in the monorepo build. |
| README.md | Mention Aptos in supported chains, OmniAddress examples, and packages list. |
| packages/sdk/tsconfig.json | Reference the new Aptos package from the umbrella SDK project. |
| packages/sdk/src/index.ts | Re-export @omni-bridge/aptos from @omni-bridge/sdk. |
| packages/sdk/package.json | Add @omni-bridge/aptos as a workspace dependency. |
| packages/near/tests/storage.test.ts | Add coverage for Aptos short-form vs padded address serialization parity. |
| packages/near/tests/chain-kind-schema.test.ts | Lock the new ChainKind.Aptos borsh discriminant byte (append-only). |
| packages/near/src/storage.ts | Extend NEAR storage-account borsh schema/address parsing to include Aptos (32-byte padded hex). |
| packages/core/tests/token.test.ts | Test aptos- wrapped-token prefix parsing maps to ChainKind.Aptos. |
| packages/core/tests/bridge.test.ts | Validate NEAR→Aptos flow + ensure Aptos as source errors as unsupported until deployed. |
| packages/core/tests/api.test.ts | Add a transfer parsing test for an Aptos transaction variant payload. |
| packages/core/tests/address.test.ts | Add Aptos OmniAddress construction/parsing and isEvmChain classification check. |
| packages/core/src/utils/token.ts | Add "aptos-" prefix mapping for wrapped-token origin-chain inference. |
| packages/core/src/utils/address.ts | Add aptos prefix ↔ ChainKind.Aptos mappings. |
| packages/core/src/types.ts | Add ChainKind.Aptos, aptos: OmniAddress variant, and ChainPrefix member. |
| packages/core/src/index.ts | Export the new AptosAddresses type from config via core’s public index. |
| packages/core/src/config.ts | Introduce AptosAddresses and optional aptos?: in ChainAddresses. |
| packages/core/src/bridge.ts | Wire Aptos into API chain-name mapping and contract-address resolution (gated until deployed). |
| packages/core/src/api.ts | Add "Aptos" to API chain enum + add Aptos transaction variant schema. |
| packages/aptos/tsconfig.json | New TS project config for the Aptos package (composite build, references core). |
| packages/aptos/tests/events.test.ts | Test Aptos event log extraction/parsing, hash validation, and view call behavior. |
| packages/aptos/tests/encoding.test.ts | Test address normalization/bytes conversion, signature splitting, object address derivation, event-data canonicalization. |
| packages/aptos/tests/builder.test.ts | Test payload argument ordering and encoding conventions for all builder methods. |
| packages/aptos/src/index.ts | Public exports for builder/encoding/events with Aptos-prefixed helper names. |
| packages/aptos/src/events.ts | Implement Aptos fullnode REST transaction fetching + bridge event extraction/parsing helpers. |
| packages/aptos/src/encoding.ts | Implement Aptos address normalization, signature splitting, UTF-8 helpers, and named-object address derivation. |
| packages/aptos/src/builder.ts | Implement createAptosBuilder and payload construction for Move entry functions. |
| packages/aptos/README.md | Package-level documentation and usage examples for the Aptos builder/helpers. |
| packages/aptos/package.json | Define the new @omni-bridge/aptos package metadata and dependencies. |
| docs/reference/core.mdx | Update core reference docs to include fogo + aptos OmniAddress/ChainKind/ChainPrefix/Chain docs and config types. |
| docs/reference/aptos.mdx | Add full reference docs for the new @omni-bridge/aptos API surface. |
| docs/introduction.mdx | Add Aptos to the chain cards and package list. |
| docs/guides/aptos.mdx | Add an Aptos guide describing validate-then-build flow and Aptos-specific mechanics. |
| docs/getting-started.mdx | Add Aptos to the “pick your source chain” guide cards. |
| docs/docs.json | Add Aptos guide/reference pages to docs navigation and update docs description. |
| docs/core-concepts/omni-addresses.mdx | Document aptos: OmniAddress prefix and APT native token representation details. |
| CLAUDE.md | Update repo structure and builder pattern documentation to include Aptos. |
| bun.lock | Add @omni-bridge/aptos workspace entry and SDK dependency link. |
| .github/workflows/claude-pr-review.yml | Add workflow to run Claude-based code review on PR events / mentions. |
| .github/scripts/fetch-pr-comments.sh | Add helper script to fetch PR comment/review-thread context via GraphQL. |
| .github/prompts/pr-review.prompt.md | Add TypeScript PR review prompt used by the Claude review workflow (includes Aptos). |
| .changeset/curly-eyes-search.md | Changeset for Aptos support across core/near/aptos/sdk packages. |
| .changeset/config.json | Add @omni-bridge/aptos to the fixed changeset group. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 190a9428df
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pull-requests: read | ||
| issues: read |
There was a problem hiding this comment.
Grant write permission for PR comments
When this workflow runs on an opened PR or an @claude review comment, the prompt requires the agent to post the review with gh pr comment, but the job only grants pull-requests: read and issues: read. GitHub's token permissions must include a write scope for creating PR/issue comments, and Anthropic's action setup also calls for read/write Issues and Pull requests, so these runs can complete the analysis and then fail to publish any review output; change the relevant scope(s) to write or pass a GitHub App token with comment permissions.
Useful? React with 👍 / 👎.
| - name: Checkout repository | ||
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 | ||
| with: | ||
| fetch-depth: 1 |
There was a problem hiding this comment.
Check out the PR head for comment-triggered reviews
For issue_comment events, actions/checkout has no pull request ref in the event payload, so this step checks out the default branch while the prompt later tells Claude to use local Read, Grep, and Glob for repository context. Any @claude review rerun on an existing PR will therefore inspect base-branch files instead of the PR's files, producing stale or incorrect review comments unless the workflow explicitly resolves and checks out the PR head/merge ref for comment-triggered runs.
Useful? React with 👍 / 👎.
Adds Aptos as a supported chain, ported from the reference implementations in
Near-One/bridge-sdk-rs#294 (Rust SDK) and Near-One/omni-bridge#626 (Move locker).
New package: @omni-bridge/aptos
createAptosBuilder({ network, bridgeAddress? })builds entry-function payloadsfor the
omni_bridgeMove package:buildTransfer(init_transfer — no approvalstep, the contract pulls from the signer),
buildLogMetadata,buildDeployToken,and
buildFinalization(fin_transfer from a NEAR SignTransferEvent, 65-byte MPCsignature split into rs/v).
InputEntryFunctionDatafrom@aptos-labs/ts-sdk — pass directly to
aptos.transaction.build.simple()or awallet adapter. Verified against ts-sdk v7.1.0: every argument converts to the
exact BCS bytes the Move contract expects (addresses as canonical 64-hex strings,
u64/u128 as decimal strings, vector as byte arrays, Option None as null).
(
getAptosInitTransferLogetc. with canonical sorted-key JSON data),isAptosTransferFinalised, and offline derivation of the bridge state object andbridged-token FA addresses.
Core wiring
ChainKind.Aptos = 13(matches the Rust omni_types borsh discriminant),aptos:OmniAddress prefix (32-byte hex, short forms zero-padded), API schemas for the
"Aptos" chain and its transaction shape,
aptos-NEAR token prefix.0xa; Aptos decimals cap at 8 (FA amountsare u64).
validateTransferthrows UNSUPPORTED_CHAIN for Aptos sources and the builderrequires an explicit
bridgeAddressuntil then.Docs & tests
chain lists updated across README/docs, package README, changeset.
generated with @aptos-labs/ts-sdk), event parsing, borsh discriminants, and
storage account derivation. 341 tests pass; build/typecheck/lint clean.
Misc
bridge-indexer: pinned claude-code-action, ANTHROPIC_API org secret, repo-specific
review prompt).